package com.quasar.hpatient.bean.home_medicine;

import com.quasar.hpatient.R;

import java.util.List;

public final class MedicineTodayBean {

    private String patientid = "";
    private String prescription_date = "";
    private List<ItemBean> datas = null;
    private int warn_sign = 0;

    public int getWarn_sign() {
        return warn_sign;
    }

    public int getStatus() {
        return status;
    }

    private int status = 0;

    public String getPatientid() {
        return patientid;
    }

    public void setPatientid(String patientid) {
        this.patientid = patientid;
    }

    public String getPrescription_date() {
        return prescription_date;
    }

    public void setPrescription_date(String prescription_date) {
        this.prescription_date = prescription_date;
    }

    public List<ItemBean> getDatas() {
        return datas;
    }

    public void setDatas(List<ItemBean> datas) {
        this.datas = datas;
    }

    public final static class ItemBean {

        private String mname="";
        private int use_order;
        private int use_number;
        private String dose_name;
        private String use_time;
        private String real_use_time;
        private int status;

        public boolean isMedicineNull(){
            return "".equals(mname);
        }

        public String getMname() {
            return mname;
        }

        public void setMname(String mname) {
            this.mname = mname;
        }

        public int getUse_order() {
            return use_order;
        }

        public void setUse_order(int use_order) {
            this.use_order = use_order;
        }

        public int getUse_number() {
            return use_number;
        }

        public void setUse_number(int use_number) {
            this.use_number = use_number;
        }

        public String getDose_name() {
            return dose_name;
        }

        public void setDose_name(String dose_name) {
            this.dose_name = dose_name;
        }

        public String getUse_time() {
            return use_time;
        }

        public void setUse_time(String use_time) {
            this.use_time = use_time;
        }

        public String getReal_use_time() {
            return real_use_time;
        }

        public void setReal_use_time(String real_use_time) {
            this.real_use_time = real_use_time;
        }

        public int getStatus() {
            return status;
        }

        public void setStatus(int status) {
            this.status = status;
        }
        public String getMedicineInfo() {

            switch (status){
                case 0:
                    return "未服";
                case 1:
                    return "已服";
                case 2:
                    try {
                        return real_use_time.substring(11, 16);
                    } catch (Exception e) {
                        return "00:00";
                    }
                case 3:
                    return getUse_time().substring(0,5);
                case 4:
                    return "一键服药";
            }


            return "未知";

//            if (status == 0) {
//                return "未服";
//            } else {
//                try {
//                    return real_use_time.substring(11, 16);
//                } catch (Exception e) {
//                    return "00:00";
//                }
//            }
        }

        public String getMedicineTime() {
            try {
                return use_time.substring(0, 5);
            } catch (Exception e) {
                return "00:00";
            }
        }

        public int getMedicineColors() {


            switch (status){
                case 0:
                    return R.color.color_black;
                case 1:
                    return R.color.color_bg_theme;
                case 2:
                    return R.color.color_bg_peach;
                case 3:
                    return R.color.color_bg_theme;
                case 4:
                    return R.color.color_bg_theme;
            }
            return R.color.color_bg_peach;

        }

        public boolean isMedicineOral() {
            return status != 0;
        }


        public String getMedicineNumbers() {
            return String.valueOf(use_number);
        }



    }
}
